﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GA.Shared.Interfaces;
using System.Windows;
using System.Runtime.Serialization;
using System.Windows.Data;

namespace GA.Shared.Objects
{
    public class PermissionType : LinkedDependencyObject
    {
        /// <summary>
        /// Identifies the Id Property.
        /// </summary>
        public static readonly DependencyProperty IdProperty =
            RegisterProperty(
                "Id",
                typeof(int),
                typeof(PermissionType),
                new PropertyMetadata(-1));

        /// <summary>
        /// Identifies the Name Property.
        /// </summary>
        public static readonly DependencyProperty NameProperty =
            RegisterProperty(
                "Name",
                typeof(string),
                typeof(PermissionType),
                new PropertyMetadata(string.Empty));

        /// <summary>
        /// Identifies the IsServerAdminPermission Property.
        /// </summary>
        public static readonly DependencyProperty IsServerAdminPermissionProperty =
            RegisterProperty(
                "IsServerAdminPermission",
                typeof(bool),
                typeof(PermissionType),
                new PropertyMetadata(false));

        /// <summary>
        /// Identifies the IsNonSAViewable Property.
        /// </summary>
        public static readonly DependencyProperty IsNonSAViewableProperty =
            RegisterProperty(
                "IsNonSAViewable",
                typeof(bool),
                typeof(PermissionType),
                new PropertyMetadata(false));

        /// <summary>
        /// Gets or sets the Id.
        /// </summary>
        
        public int Id
        {
            get { return (int)SafeGetValue(IdProperty); }
            set { SafeSetValue(IdProperty, value); }
        }

        /// <summary>
        /// Gets or sets the Name.
        /// </summary>
        
        public string Name
        {
            get { return (string)SafeGetValue(NameProperty); }
            set { SafeSetValue(NameProperty, value); }
        }

        /// <summary>
        /// Gets or sets if this is a permission settable only by Server Admins.
        /// </summary>
        
        public bool IsServerAdminPermission
        {
            get { return (bool)SafeGetValue(IsServerAdminPermissionProperty); }
            set { SafeSetValue(IsServerAdminPermissionProperty, value); }
        }

        /// <summary>
        /// Gets or sets if this is viewable by non-server admins.
        /// </summary>
        
        public bool IsNonSAViewable
        {
            get { return (bool)SafeGetValue(IsNonSAViewableProperty); }
            set { SafeSetValue(IsNonSAViewableProperty, value); }
        }

        public PermissionType()
        {
        }

        public PermissionType(LinkedDependencyObject baseObject)
            : base(baseObject)
        {
        }

        public PermissionType(LinkedDependencyObject baseObject, BindingMode bindingMode)
            : base(baseObject, bindingMode)
        {
        }
    }
}
